

function saveLeader(){
    var weekDate = $("#weekDate").val();
    if(weekDate == ""){
        alert("日期不能为空");
        return;
    }
    var workArrangement = $("#workArrangement").val();
    if(workArrangement == ""){
        alert("工作安排不能为空");
        return;
    }
    var weekTime = $("#weekTime").val();
    if(weekTime == ""){
        alert("时间不能为空");
        return;
    }
    var place = $("#place").val();
    if(place == ""){
        alert("地点不能为空");
        return;
    }
    var managingLeader = $("#managingLeader").val();
    if(managingLeader == ""){
        alert("办领导不能为空");
        return;
    }
    var leadOffice = $("#leadOffice").val();
    if(leadOffice == ""){
        alert("牵头处室不能为空");
        return;
    }

    var ajax = new $ax("/department/save", function (data) {
        // 成功
        if (data.status == "true") {
            alert("添加成功");
            window.location.href='department.html';
        } else {
            // mui.alert(data.message);
            alert("添加失败");
        }

    }, function (data) {
        // 失败
        alert("访问失败");
        errorAjax();
        alert("添加失败");
    });

    ajax.setToken(cookie.get("token"));
    ajax.set("weekDate",weekDate);
    ajax.set("workArrangement",workArrangement);
    ajax.set("weekTime",weekTime);
    ajax.set("place",place);
    ajax.set("managingLeader",managingLeader);
    ajax.set("leadOffice",leadOffice);
    ajax.start();

}

function showDateYYYYmmdd(id) {
    $('#'+id).datetimepicker({
        //language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'yyyy-mm-dd hh:mm',
        language: 'zh'
    });
}
function showDatehhmm(id) {
    $('#'+id).datetimepicker({
        //language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'hh:mm',
        language: 'zh'
    });
}
function onWeekDate(id){
    $('#'+id).datetimepicker({
        //language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'yyyy-mm-dd hh:mm',
        language: 'zh'
    });
}

//return y + '-' + m + '-' + d +' '+h+':'+minute;
function formatDateTimeYMDHM(inputTime) {
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    // return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;
    return y + '-' + m + '-' + d +' '+h+':'+minute;
};